<h2 class="jquery_tab_title">用户管理</h2>
<input type='hidden' id='user_num' value='<?php echo $user_num ?>'/>
<input type='hidden' id='per_page' value='<?php echo PER_PAGE ?>'/>
<form class='um' id='search_form'>
	<span>关键字：<input class='input-small' type='text' value='<?php echo $keywords ?>' id='keywords'/></span>
	
	<script>
	//给下拉菜单绑值
	$(function() {
		var user_array = getAllUserCategory();
		for (var i= 0; i < user_array.length; i++) {
			$('#user_category').append("<option value=" + (i + 1) + ">" + user_array[i] + "</option>");
		}
		$('#user_category option').each(function() {
			if($(this).val() == <?php echo $user_category + "" ?>) {
				$(this).attr("selected", "selected");
			}
		});
	});
	</script>
	<span>用户类别：
	<select id='user_category' >
		<option value="">请选择</option>
	</select>
	</span>
	
	<input class='button' id='search_submit' type='button' value='查询'/>
	
	<input class='button' id='create_new' type='button' value='添加管理员'/>
	
	<div id='um_creat_newer_dialog' title='给网站添加管理员'>
	<p>
		<span>用户名</span>
		<input class='input-small' type='text' value='' id='user_name'/>
	</p>
	<p>
		<span>&nbsp;&nbsp;&nbsp;密码</span>
		<input class='input-small' type='text' value='' id='password'/>
	</p>
	<p>
		<span>&nbsp;&nbsp;&nbsp;类型</span>
		<script>
		//给下拉菜单绑值
		$(function() {
			var admin_array = getAllAdminCategory();
			for (var i= 0; i < admin_array.length; i++) {
				$('#category_id').append("<option value=" + (i + 1) + ">" + admin_array[i] + "</option>");
			}
		});
		</script>
		<select id='category_id'>
			<option value="">请选择</option>
		</select>
	</p>
	<div id='create_msg'></div>
	</div>
	<script>
	$("#um_creat_newer_dialog").dialog({
		autoOpen: false,
		resizable: false,
		draggable: false,
		width: 300,
		height: 300,
		modal: true,
		buttons: {
			"确定": function() {
				var user_name = $("#um_creat_newer_dialog #user_name").val();
				var password = $("#um_creat_newer_dialog #password").val();
				var category_id = $("#um_creat_newer_dialog #category_id").val();
				
				Admin.um.create(user_name, password, category_id);
				$(this).ajaxComplete(function(){
					if (Admin.um.create_is_succeed == true) {
						$( this ).dialog( "close" );
					}
				});
			},
			"取消": function() {
				$( this ).dialog( "close" );
			}
		}
	});
	</script>
</form><br />
<?php if ($user_num > 0):?>
<table id='table_liquid' cellspacing='0'>
	<caption>查询到相关账户<?php echo $user_num ?>个</caption>
	<tr>
	<th class='nobg'>UID</th>
	<th>登录名</th>
	<th>电子邮箱</th>
	<th>类型</th>
	<th>注册时间</th>
	<th>账户操作</th>
	</tr>
	
	<?php foreach ($user_info as $v):?>
	<tr>
	<th class='specalt'><?php echo $v['id']?></th>
	<td class='alt'><?php echo $v['name']?></td>
	<td class='alt'><?php echo $v['email'] ? $v['email'] : '-' ?></td>
	<td class='alt'><?php echo $this->common_data->_get_user_category_name_by_cid($v['category_id'])?></td>
	<td class='alt'><?php echo date("Y-m-d H:i", $v['create_time'])?></td>
	<td class='alt'>
	<?php if ($v['id'] != $_SESSION['id']):?>
		<?php if ($v['category_id'] == TEACHER_UCID):?>
		<span><a id='<?php echo $v['id']?>' class='um modify'>修改</a></span>
		<?php else :?>
		<span><a id='<?php echo $v['id']?>' class='um modify'>修改</a> | <a id='<?php echo $v['id']?>' class='um delete'>删除</a></span>
		<?php endif;?>
	<?php else :?>
		<span>无法操作本人账户</span>
	<?php endif;?>
	</td>
	</tr>
	<?php endforeach;?>
</table>
<div id='Pagination' style='display: none;'></div>
<?php else :?>
<strong id='error_msg' style='background: url(/admin_style/images/attention.png) no-repeat; color: #f60;'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;悲剧了，没有找到您要的查询结果</strong>
<?php endif;?>